<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Workflow Preview Dashboard</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
            color: #333;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
        }

        .workflow-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 20px;
            margin-bottom: 40px;
        }

        .workflow-card {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 12px;
            padding: 15px;
            box-shadow: 0 8px 20px rgba(0,0,0,0.1);
            transition: all 0.3s ease;
            border: 1px solid rgba(255,255,255,0.2);
            backdrop-filter: blur(10px);
        }

        .workflow-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 25px 50px rgba(0,0,0,0.15);
        }

        .workflow-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 12px;
        }

        .workflow-title {
            font-size: 1.1rem;
            font-weight: 600;
            color: #2d3748;
        }

        .workflow-status {
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 0.85rem;
            font-weight: 500;
        }

        .status-active {
            background: #d4edda;
            color: #155724;
        }

        .status-draft {
            background: #fff3cd;
            color: #856404;
        }

        .workflow-preview {
            background: #1a202c;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 15px;
            position: relative;
            overflow: hidden;
            height: 180px;
        }

        .workflow-flow {
            position: relative;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .flow-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: relative;
        }

        .flow-row.top {
            justify-content: center;
        }

        .flow-row.middle {
            justify-content: center;
        }

        .flow-row.bottom {
            justify-content: space-around;
        }

        .node {
            background: #2d3748;
            border: 2px solid #4a5568;
            border-radius: 8px;
            padding: 8px 12px;
            color: white;
            font-size: 0.75rem;
            font-weight: 500;
            position: relative;
            min-width: 80px;
            text-align: center;
            transition: all 0.3s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
        }

        .node-icon {
            width: 20px;
            height: 20px;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 10px;
        }

        .node.trigger .node-icon {
            background: #e53e3e;
        }

        .node.ai-agent .node-icon {
            background: #667eea;
        }

        .node.condition .node-icon {
            background: #38a169;
        }

        .node.integration .node-icon {
            background: #d69e2e;
        }

        .flow-line {
            position: absolute;
            background: #718096;
            z-index: 1;
        }

        .flow-line.vertical {
            width: 2px;
            left: 50%;
            transform: translateX(-50%);
        }

        .flow-line.horizontal {
            height: 2px;
            top: 50%;
            transform: translateY(-50%);
        }

        .flow-line.diagonal {
            height: 2px;
            transform-origin: left center;
        }

        .branch-point {
            position: absolute;
            width: 8px;
            height: 8px;
            background: #718096;
            border-radius: 50%;
            left: 50%;
            transform: translateX(-50%);
        }

        .workflow-stats {
            display: flex;
            justify-content: space-between;
            margin-bottom: 10px;
        }

        .stat {
            text-align: center;
        }

        .stat-value {
            font-size: 1.2rem;
            font-weight: 700;
            color: #667eea;
        }

        .stat-label {
            font-size: 0.7rem;
            color: #718096;
            margin-top: 2px;
        }

        .workflow-actions {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
        }

        .btn {
            padding: 6px 12px;
            border: none;
            border-radius: 6px;
            font-size: 0.8rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .btn-primary {
            background: #667eea;
            color: white;
        }

        .btn-primary:hover {
            background: #5a67d8;
        }

        .btn-secondary {
            background: #e2e8f0;
            color: #4a5568;
        }

        .btn-secondary:hover {
            background: #cbd5e0;
        }

        .create-workflow {
            position: fixed;
            bottom: 30px;
            right: 30px;
            width: 60px;
            height: 60px;
            background: #667eea;
            border: none;
            border-radius: 50%;
            color: white;
            font-size: 1.5rem;
            cursor: pointer;
            box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
            transition: all 0.3s ease;
        }

        .create-workflow:hover {
            transform: scale(1.1);
            box-shadow: 0 15px 35px rgba(102, 126, 234, 0.6);
        }

        @media (max-width: 768px) {
            .workflow-grid {
                grid-template-columns: 1fr;
            }
            
            .workflow-nodes {
                flex-direction: column;
            }
            
            .connection {
                display: none;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="workflow-grid">
            <!-- Workflow 1: User Management -->
            <div class="workflow-card">
                <div class="workflow-header">
                    <h3 class="workflow-title">User Management</h3>
                    <span class="workflow-status status-active">Active</span>
                </div>
                <div class="workflow-preview">
                    <div class="workflow-flow">
                        <div class="flow-row top">
                            <div class="node trigger">
                                <div class="node-icon">⚡</div>
                                <span>Form</span>
                            </div>
                        </div>
                        <div class="flow-line vertical" style="top: 25px; height: 40px;"></div>
                        <div class="flow-row middle">
                            <div class="node ai-agent">
                                <div class="node-icon">🤖</div>
                                <span>AI Agent</span>
                            </div>
                        </div>
                        <div class="flow-line vertical" style="top: 85px; height: 40px;"></div>
                        <div class="branch-point" style="top: 125px;"></div>
                        <div class="flow-line diagonal" style="top: 125px; left: 50%; width: 60px; transform: translateX(-50%) rotate(25deg);"></div>
                        <div class="flow-line diagonal" style="top: 125px; right: 50%; width: 60px; transform: translateX(50%) rotate(-25deg);"></div>
                        <div class="flow-row bottom">
                            <div class="node condition">
                                <div class="node-icon">💼</div>
                                <span>Manager</span>
                            </div>
                            <div class="node integration">
                                <div class="node-icon">💬</div>
                                <span>Slack</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="workflow-stats">
                    <div class="stat">
                        <div class="stat-value">247</div>
                        <div class="stat-label">Runs</div>
                    </div>
                    <div class="stat">
                        <div class="stat-value">98%</div>
                        <div class="stat-label">Success</div>
                    </div>
                </div>
                <div class="workflow-actions">
                    <button class="btn btn-secondary">Edit</button>
                    <button class="btn btn-primary">View</button>
                </div>
            </div>

            <!-- Workflow 2: Order Processing -->
            <div class="workflow-card">
                <div class="workflow-header">
                    <h3 class="workflow-title">Order Processing</h3>
                    <span class="workflow-status status-active">Active</span>
                </div>
                <div class="workflow-preview">
                    <div class="workflow-flow">
                        <div class="flow-row top">
                            <div class="node trigger">
                                <div class="node-icon">📡</div>
                                <span>API</span>
                            </div>
                        </div>
                        <div class="flow-line vertical" style="top: 25px; height: 40px;"></div>
                        <div class="flow-row middle">
                            <div class="node ai-agent">
                                <div class="node-icon">🤖</div>
                                <span>Validator</span>
                            </div>
                        </div>
                        <div class="flow-line vertical" style="top: 85px; height: 40px;"></div>
                        <div class="branch-point" style="top: 125px;"></div>
                        <div class="flow-line diagonal" style="top: 125px; left: 50%; width: 60px; transform: translateX(-50%) rotate(25deg);"></div>
                        <div class="flow-line diagonal" style="top: 125px; right: 50%; width: 60px; transform: translateX(50%) rotate(-25deg);"></div>
                        <div class="flow-row bottom">
                            <div class="node condition">
                                <div class="node-icon">✅</div>
                                <span>Valid</span>
                            </div>
                            <div class="node integration">
                                <div class="node-icon">💾</div>
                                <span>Database</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="workflow-stats">
                    <div class="stat">
                        <div class="stat-value">1,342</div>
                        <div class="stat-label">Runs</div>
                    </div>
                    <div class="stat">
                        <div class="stat-value">95%</div>
                        <div class="stat-label">Success</div>
                    </div>
                </div>
                <div class="workflow-actions">
                    <button class="btn btn-secondary">Edit</button>
                    <button class="btn btn-primary">View</button>
                </div>
            </div>

            <!-- Workflow 3: Email Campaign -->
            <div class="workflow-card">
                <div class="workflow-header">
                    <h3 class="workflow-title">Email Campaign</h3>
                    <span class="workflow-status status-draft">Draft</span>
                </div>
                <div class="workflow-preview">
                    <div class="workflow-flow">
                        <div class="flow-row top">
                            <div class="node trigger">
                                <div class="node-icon">⏰</div>
                                <span>Schedule</span>
                            </div>
                        </div>
                        <div class="flow-line vertical" style="top: 25px; height: 40px;"></div>
                        <div class="flow-row middle">
                            <div class="node ai-agent">
                                <div class="node-icon">🤖</div>
                                <span>Content</span>
                            </div>
                        </div>
                        <div class="flow-line vertical" style="top: 85px; height: 40px;"></div>
                        <div class="branch-point" style="top: 125px;"></div>
                        <div class="flow-line diagonal" style="top: 125px; left: 50%; width: 60px; transform: translateX(-50%) rotate(25deg);"></div>
                        <div class="flow-line diagonal" style="top: 125px; right: 50%; width: 60px; transform: translateX(50%) rotate(-25deg);"></div>
                        <div class="flow-row bottom">
                            <div class="node condition">
                                <div class="node-icon">👍</div>
                                <span>Approve</span>
                            </div>
                            <div class="node integration">
                                <div class="node-icon">📧</div>
                                <span>Email</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="workflow-stats">
                    <div class="stat">
                        <div class="stat-value">0</div>
                        <div class="stat-label">Runs</div>
                    </div>
                    <div class="stat">
                        <div class="stat-value">--</div>
                        <div class="stat-label">Success</div>
                    </div>
                </div>
                <div class="workflow-actions">
                    <button class="btn btn-secondary">Edit</button>
                    <button class="btn btn-primary">Deploy</button>
                </div>
            </div>

            <!-- Workflow 4: Support Ticket -->
            <div class="workflow-card">
                <div class="workflow-header">
                    <h3 class="workflow-title">Support Ticket</h3>
                    <span class="workflow-status status-active">Active</span>
                </div>
                <div class="workflow-preview">
                    <div class="workflow-flow">
                        <div class="flow-row top">
                            <div class="node trigger">
                                <div class="node-icon">🎫</div>
                                <span>Ticket</span>
                            </div>
                        </div>
                        <div class="flow-line vertical" style="top: 25px; height: 40px;"></div>
                        <div class="flow-row middle">
                            <div class="node ai-agent">
                                <div class="node-icon">🤖</div>
                                <span>Category</span>
                            </div>
                        </div>
                        <div class="flow-line vertical" style="top: 85px; height: 40px;"></div>
                        <div class="branch-point" style="top: 125px;"></div>
                        <div class="flow-line diagonal" style="top: 125px; left: 50%; width: 60px; transform: translateX(-50%) rotate(25deg);"></div>
                        <div class="flow-line diagonal" style="top: 125px; right: 50%; width: 60px; transform: translateX(50%) rotate(-25deg);"></div>
                        <div class="flow-row bottom">
                            <div class="node condition">
                                <div class="node-icon">🔥</div>
                                <span>Priority</span>
                            </div>
                            <div class="node integration">
                                <div class="node-icon">👤</div>
                                <span>Assign</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="workflow-stats">
                    <div class="stat">
                        <div class="stat-value">89</div>
                        <div class="stat-label">Runs</div>
                    </div>
                    <div class="stat">
                        <div class="stat-value">92%</div>
                        <div class="stat-label">Success</div>
                    </div>
                </div>
                <div class="workflow-actions">
                    <button class="btn btn-secondary">Edit</button>
                    <button class="btn btn-primary">View</button>
                </div>
            </div>

            <!-- Workflow 5: Data Sync -->
            <div class="workflow-card">
                <div class="workflow-header">
                    <h3 class="workflow-title">Data Sync</h3>
                    <span class="workflow-status status-active">Active</span>
                </div>
                <div class="workflow-preview">
                    <div class="workflow-flow">
                        <div class="flow-row top">
                            <div class="node trigger">
                                <div class="node-icon">⏲️</div>
                                <span>Timer</span>
                            </div>
                        </div>
                        <div class="flow-line vertical" style="top: 25px; height: 40px;"></div>
                        <div class="flow-row middle">
                            <div class="node ai-agent">
                                <div class="node-icon">🤖</div>
                                <span>Mapper</span>
                            </div>
                        </div>
                        <div class="flow-line vertical" style="top: 85px; height: 40px;"></div>
                        <div class="branch-point" style="top: 125px;"></div>
                        <div class="flow-line diagonal" style="top: 125px; left: 50%; width: 60px; transform: translateX(-50%) rotate(25deg);"></div>
                        <div class="flow-line diagonal" style="top: 125px; right: 50%; width: 60px; transform: translateX(50%) rotate(-25deg);"></div>
                        <div class="flow-row bottom">
                            <div class="node condition">
                                <div class="node-icon">🔄</div>
                                <span>Changed</span>
                            </div>
                            <div class="node integration">
                                <div class="node-icon">🔗</div>
                                <span>Sync</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="workflow-stats">
                    <div class="stat">
                        <div class="stat-value">756</div>
                        <div class="stat-label">Runs</div>
                    </div>
                    <div class="stat">
                        <div class="stat-value">99%</div>
                        <div class="stat-label">Success</div>
                    </div>
                </div>
                <div class="workflow-actions">
                    <button class="btn btn-secondary">Edit</button>
                    <button class="btn btn-primary">View</button>
                </div>
            </div>
        </div>
    </div></h3>
                    <span class="workflow-status status-active">Active</span>
                </div>
                <div class="workflow-preview">
                    <div class="workflow-nodes">
                        <div class="node trigger">
                            Timer
                            <div class="connection"></div>
                        </div>
                        <div class="node ai-agent">
                            Data Mapper
                            <div class="connection"></div>
                        </div>
                        <div class="node condition">
                            Changed?
                            <div class="connection"></div>
                        </div>
                        <div class="node integration">
                            Sync Systems
                        </div>
                    </div>
                </div>
                <div class="workflow-stats">
                    <div class="stat">
                        <div class="stat-value">756</div>
                        <div class="stat-label">Executions</div>
                    </div>
                    <div class="stat">
                        <div class="stat-value">99%</div>
                        <div class="stat-label">Success Rate</div>
                    </div>
                    <div class="stat">
                        <div class="stat-value">4.2s</div>
                        <div class="stat-label">Avg Time</div>
                    </div>
                </div>
                <div class="workflow-actions">
                    <button class="btn btn-secondary">Edit</button>
                    <button class="btn btn-primary">View</button>
                </div>
            </div>
        </div>
    </div>

    <button class="create-workflow" onclick="alert('Create new workflow')">+</button>

    <script>
        // Add some interactive functionality
        document.querySelectorAll('.workflow-card').forEach(card => {
            card.addEventListener('click', function(e) {
                if (!e.target.classList.contains('btn')) {
                    // Add some visual feedback when clicking on cards
                    this.style.transform = 'scale(0.98)';
                    setTimeout(() => {
                        this.style.transform = '';
                    }, 150);
                }
            });
        });

        // Button click handlers
        document.querySelectorAll('.btn').forEach(btn => {
            btn.addEventListener('click', function(e) {
                e.stopPropagation();
                const action = this.textContent;
                const workflowTitle = this.closest('.workflow-card').querySelector('.workflow-title').textContent;
                alert(`${action} workflow: ${workflowTitle}`);
            });
        });
    </script>
</body>
</html>